#include "matrix.hpp"
#include<bits/stdc++.h>
using namespace std;

matrix <double> A, B, C, D;
rowvec <double> u, v;
colvec <double> x, y;

void Test1(){
	cout << "Test 1: Creating a Matrix" << endl;
	
	int n1,m1,n2,m2;
	
	cin >> n1 >> m1;
	A = matrix <double> (n1, m1);
	if(A.size().first && A.size().second){
		A.read();
		cout << "A =" << endl;
		A.write();
	}
	
	cin >> n2 >> m2;
	B = matrix <double> (n2, m2);
	if(B.size().first && B.size().second){
		B.read();
		cout << "B =" << endl;
		B.write();
	}
}

void Test2(){
	cout << "Test 2: Is_square" << endl;
	cout << (A.issq() ? "A is a square" : "A is not a square") <<endl;
}



void Test3(){
	cout << "Test 3: Multiply of Matrices" << endl;
	C = A * B;
	if(C.size().first && C.size().second){
		cout << "A * B =" << endl;
		C.write();
	}
}

void Test4(){
	cout << "Test 4: Creating a Row Vector and a Col Vector" << endl;
	
	int n1, n2, m1, m2;
	
	cin >> n1;
	u=rowvec <double> (n1);
	
	u.read();
	cout << "u =" << endl;
	u.write();
	
	cin >> n2;
	v = rowvec <double> (n2);
	v.read();
	cout << "v =" << endl;
	v.write();
	
	cin >> m1;
	x = colvec <double> (m1);
	x.read();
	cout << "x =" << endl;
	x.write();
	
	cin >> m2;
	y = colvec <double> (m2);
	y.read();
	cout << "y =" << endl;
	y.write();
}

void Test5(){
	cout << "Test 5: Multiply of Vectors" << endl;
	double r;
	r = u * x;
	cout << "u * x = " << r << endl;
	r = u * v;
	cout << "u . v = " << r << endl;
	r = x * y;
	cout << "x . y = " << r << endl;
	matrix <double> H;
	H = x * u;
	if(H.size().first && H.size().second){
		cout << "x * u = " <<endl;
		H.write();
	}
}

int main(){
	cout << "Test begin." << endl;
	Test1();
	Test2();
	Test3();
	Test4();
	Test5();
}
